home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
prog
/
ansicvid.zip
/
ANSICVID.C
Wrap
Text File
|
1989-07-14
|
3KB
|
141 lines
/* ansivid.c */
/* ANSI control routines for MS-DOS video */
/* In Public Domain */
/* for use with Microsoft C ver. 3.0 compiler */
/*****************************************************************/
/*----------- NOTE: YOU MUST INVOKE 'DEVICE=ANSI.SYS' AT DOS LEVEL AND---*/
/*------------------YOU MUST HAVE THE FILE 'ANSI.SYS' LOCATED------------*/
/* ---------------- IN YOUR ROOT DIRECTORY ----------------------------*/
/*************************************************************************/
/* Sept 10 1986 */
/* L. Stephen Bell, c/o Lunar & Planetary Lab, Univ. of Az,Tucson Arizona */
/* 85721 602-886-0421 */
/* Please give me a call or send your new ideas for */
/* incorporation into the next revision of this code*/
#include <conio.h> /* HSR PACKAGE */
/* test routine for the functions to follow: delete this code or comment it */
/* out after you have seen how everything works */
main()
{
cls();
printf("This is normal text printed via the printf function.\n");
delay(32000);
tputs(12,12,"This is printed at 12,12 location.\n");
delay(45000);
bold();
tputs(14,14,"This is bold.\n");
delay(45000);
reverse();
tputs(1,20,"Reverse");
delay(45000);
normal();
blink();
tputs(2,19,"Blinking");
delay(45000);
blink_rev();
tputs(4,12,"Blinking AND reverse!");
delay(45000);
normal();
tputs(6,15,"This line will be partly erased to its end . . . . ");
delay(145000);
locate(6,25);
clr_eol();
delay(45000);
normal();
}
/* end of commented out main routine */
/*------------------ end of test routine---------------------------- */
/*----------------ANSI Screen Driving Function Library:----------------*/
cls()
{
cprintf("\033[2J"); /* clear, home */
}
bold()
{
cprintf("\033[1m"); /* set for bold-printed text to follow */
}
normal()
{
cprintf("\033[0m"); /* set normal (non-bold) text to follow */
}
reverse()
{
cprintf("\033[7m"); /* set for reverse video */
}
blink()
{
cprintf("\033[5m"); /* set for blinking attribute */
}
blink_rev()
{
cprintf("\033[5;7m"); /* set for blinking AND reverse video */
}
clr_eol()
{
cprintf("\033[K"); /* clear from cursor to end of line */
}
locate(row,col) /* absolute cursor positioning */
short row,col;
{
printf("\033[%d;%df",row,col);
}
tputs(row,col,text) /* puts a text string to row,col position on screen*/
short row,col;
char *text;
{
locate(row,col);
printf("%s",text);
}
delay(time) /* variable delay routine for pauses */
unsigned time;
{
int j,k;
for( j = 0; j <= time; j++)
{
k = k /2;
k = k*2;
}
}
/* ------------------------ END ansivid.c ----------------------------*/